<template>
  <div class="mobile-treminal"
    v-loading="loading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.8)">
    <div class="mobile-treminal-top">
      <div class="mobile-treminal-top-title">{{info.point_name}}</div>
      <div class="mobile-treminal-top-locations">
        <img src="../assets/mobile/Frame 21_slices/Rectangle84.png" alt="" srcset="">
        <span>{{info.county+''+info.township+''+info.village}}</span>
        <img src="../assets/mobile/Frame 21_slices/Rectangle85.png" alt="" srcset="">
      </div>
      <!-- <div class="mobile-treminal-top-desc">安置点：{{info.danger_type}}</div> -->
      <div class="mobile-treminal-top-lonlat">经度：{{lonLat[0]}}； 纬度：{{lonLat[1]}}</div>
    </div>
    <div class="mobile-treminal-bottom">
      <div class="mobile-treminal-bottom-title">{{info.danger_type}}</div>
      <div class="mobile-treminal-bottom-box">
        <div class="mobile-treminal-bottom-box-container">
          <div class="box-container" v-for="item,index in boxList" :key="index">
            <img class="img" :src="item.img" alt="" srcset="">
            <p class="num">{{item.num}}</p>
            <p class="text">{{item.text}}</p>
          </div>
        </div>
        <div class="mobile-treminal-bottom-box-detail" v-for="item,index in detailsDataList" :key="index">
          <img :src="item.img" alt="" class="img">
          <div class="details">
            <p class="details-title">{{item.title}}</p>
            <p class="details-desc">{{item.desc}}</p>
          </div>
        </div>
        <div class="mobile-treminal-bottom-box-table">
          <el-table :data="tableData" style="width: 100%;font-size: 0.7rem;" :header-cell-style="{background:'#005DF8',color:'rgb(248, 248, 248)',height:'1.5rem',borderRadius: '0.85rem'}">
            <el-table-column align="center" prop="date" label="部门" :show-overflow-tooltip="true"/>
            <el-table-column align="center" prop="name" label="姓名" :show-overflow-tooltip="true"/>
            <el-table-column align="center" prop="address" label="联系电话" :show-overflow-tooltip="true"/>
          </el-table>
        </div>
    </div>
    </div>
  </div>
</template>

<script>
import * as API from '../api/dataResource/index'
export default {
  data() {
    return {
      loading: true,
      tableData: [],
      boxList: [
        {
          img: require('../assets/mobile/Frame 21_slices/Frame.png'),
          num: 35,
          text: '受威胁户数'
        },
        {
          img: require('../assets/mobile/Frame 21_slices/Frame(1).png'),
          num: 135,
          text: '受威胁人口'
        }
      ],
      detailsDataList: [
        {
          img: require('../assets/mobile/Frame 21_slices/Group 116.png'),
          title: '防灾措施',
          desc: '受威胁时启动叫醒机制，指定路线及时转移群众。'
        },
        {
          img: require('../assets/mobile/Frame 21_slices/Group 117.png'),
          title: '救援通道',
          desc: '煤窑沟村入村主干道有1条:煤窑沟村主干道。'
        },
        {
          img: require('../assets/mobile/Frame 21_slices/Group 118.png'),
          title: '疏散路线',
          desc: '煤窑沟村二社(阴山)-(沿着煤窑沟村二社硬化主干道向北)-煤窑沟村党员活动室。'
        }
      ],
      info: {},
      lonLat: []
    }
  },
  created() {
    console.log(this.$route, '========')
    // console.log(this.loading, 'this.loading')
    if (this.$route.query && this.$route.query.catalogId && this.$route.query.pkName && this.$route.query.pkValue) {
      this.getMapGetInfo(this.$route.query)
    }
  },
  methods: {
    getMapGetInfo(query) {
      const params = {
        ...query
      }
      API.mapGetInfo(params).then(res => {
        if (res.code === 200) {
          this.lonLat = res.data.geom.split(',')
          this.info = res.data
          this.boxList[0].num = res.data.threatened_household
          this.boxList[1].num = res.data.threatened_population
          this.detailsDataList[0].desc = res.data.disaster_prevention_measure
          this.detailsDataList[1].desc = res.data.rescue_channel
          this.detailsDataList[2].desc = res.data.evacuation_route
          this.tableData = [{ date: '行政负责人', name: res.data.administrative_responsible_person, address: res.data.administrative_responsible_person_phone }, { date: '应急明白人', name: res.data.emergency_understanding_person, address: res.data.emergency_understanding_person_phone }]
          this.loading = false
        }
      })
    }
  }
}
</script>
<style lang="scss">
.el-tooltip__popper{
  font-size: 0.8rem !important;
}
</style>
<style lang="scss" scoped>

.mobile-treminal{
  // background: url('../assets/mobile/Frame 21_slices/Group 114.png') no-repeat;
  // background-size: 100% 100%;
  // background-position: center; /* 图片在盒子中居中 */
  // width: 100%;
  // display: inline-block; /* 或者使用其他布局方式，如 flex 或 grid */
  // height: fit-content; /* 根据盒子内容自动调整高度 */
  height: 100%;
  font-size: 0.7rem;
  :deep(.el-icon-loading) {
    font-size: 2rem;
  }
  :deep(.el-loading-text) {
    font-size: 0.7rem;
  }
  &-top{
    padding-top: 2rem;
    width: 100%;
    text-align: center;
    height: 8rem;
    background: url('../assets/mobile/Frame 21_slices/header.png') no-repeat;
    background-size: 100% 100%;
    &-title {
      font-size: 2rem;
      font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
      font-weight: 400;
      text-shadow: 0px 0px 0px rgba(0,0,0,0.1), 0px 4px 9px rgba(0,0,0,0.1), 0px 17px 17px rgba(0,0,0,0.09), 0px 38px 23px rgba(0,0,0,0.05), 0px 68px 27px rgba(0,0,0,0.01), 0px 106px 30px rgba(0,0,0,0);
      color: #FFFFFF;
      height: 3rem;
      line-height: 3rem;
    }
    &-locations{
      display: flex;
      align-items: center;
      justify-content: center;
      height: 1.2rem;
      img{
        width: 20%;
      }
      span{
        font-size: 0.68rem;
        font-family: Source Han Sans CN, Source Han Sans CN;
        font-weight: 400;
        color: #FFFFFF;
        margin: 0 0.2rem;
      }
    }
    &-desc{
      width: 80%;
      margin: 0.35rem auto;
      height: 2rem;
      background: #2DE5D9;
      box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.25);
      border-radius: 0.25rem;
      line-height: 2rem;
      font-size: 0.8rem;
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      color: #FFFFFF;
    }
    &-lonlat{
      font-size: 0.6rem;
      font-family: Source Han Sans CN, Source Han Sans CN;
      font-weight: 400;
      line-height: 2rem;
      color: #FFFFFF;
    }
  }
  &-bottom{
    width: 100%;
    text-align: center;
    min-height: calc(100% - 11rem);
    padding-top: 1rem;
    background: url('../assets/mobile/Frame 21_slices/bgc.png') no-repeat;
    background-size: 100% 100%;
    &-title{
      background: url('../assets/mobile/Frame 21_slices/Group 100.png') no-repeat;
      background-size: 100% 100%;
      width: 50%;
      height: 2rem;
      margin: 0 auto;
      line-height: 1.5rem;
      font-size: 0.68rem;
      font-family: 字魂59号-创粗黑, 字魂59号-创粗黑;
      font-weight: 400;
      color: #FFFFFF;
    }
    &-box{
      margin-top: 0.52rem;
      padding: 1.2rem 2rem;
      width: calc(100% - 4rem);
      background: url('../assets/mobile/Frame 21_slices/Group 115.png') no-repeat;
      background-size: 100% 100%;
      height: calc(100% - 5rem);
      &-container{
        display: flex;
        height: 5rem;
        justify-content: space-between;
        align-items: center;
        .box-container{
          background: #DFE9FF;
          border-radius: 0.19rem;
          margin-top: 0.3rem;
          width: 47%;
          height: calc(100% - 0.3rem);
          img{
            width: 30%;
          }
          .num{
            font-size: 0.96rem;
            font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
            font-weight: 400;
            color: #000000;
          }
          .text{
            font-size: 0.5rem;
            font-family: Source Han Sans CN, Source Han Sans CN;
            font-weight: 400;
            color: #000000;
          }
        }
      }
      &-detail{
        margin-top: 0.6rem;
        text-align: left;
        display: flex;
        .img{
          width: 10%;
          height: 10%;
          margin-right: 0.2rem;
        }
        .details{
          .details-title{
            font-size: 0.65rem;
            font-family: Source Han Sans CN, Source Han Sans CN;
            font-weight: bold;
            color: #000000;
            line-height: 1.5rem;
            height: 1.5rem;
          }
          .details-desc{
            font-size: 0.6rem;
            font-family: Source Han Sans CN, Source Han Sans CN;
            font-weight: 400;
            color: #787878;
            line-height: 1rem;
          }
        }
      }
      &-table{
        margin-top: 0.6rem;
        :deep(.el-table) {
          .el-table__header-wrapper{
            border-bottom: 1px solid #EBEEF5;
            padding-bottom: 0.5rem;
          }
          .el-table__header{
            .el-table__cell{
              width: 2.53rem;
            }
          }
          .cell{
            line-height: 1.5rem;
          }
          .el-table__body-wrapper{
            .cell{
              font-size: 0.8rem;
              font-family: Source Han Sans CN, Source Han Sans CN;
              font-weight: 400;
              color: #000000;
            }
          }
        }
      }
    }
  }
}

</style>
